package com.jg.controller;

import com.jg.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 86130
 * @version 1.0
 * @description: TODO
 * @date 2025/6/9 上午11:34
 */
/*@Controller
@ResponseBody*/
@RestController
@RequestMapping("/user")
public class UserController {
    //value:    请求路径
    //produces:  指定返回值类型
    //method:    请求方式
    @RequestMapping(value = "hi")
    public String getList(){
        return "员工列表数据";
    }

    @RequestMapping(value = "/getUser")
    public User getUser(){
        User user = new User();
        user.setId(1);
        user.setName("张三");
        user.setPassword("<PASSWORD>");
        user.setAge("18");
        user.setSex("男");
        user.setEmail("<EMAIL>");
        user.setPhone("12345678901");
        user.setAddress("北京");
        return user;
    }

    //接收单参数
    @RequestMapping(value = "/getOneParam")
    public String getOneParam(String name){
        System.out.println("接受单个参数 ===> name:"+name);
        return "name：" + name;
    }

    //接收多参数
    @RequestMapping(value = "/getMoreParam")
    public String getMoreParam(String name, String age){
        System.out.println("接受多个参数 ===> name:"+name+" age:"+age);
        return "name：" + name + " age：" + age;
    }
}
